<?php

class Ads_Form_Contactowner extends Zend_Form {

    public function init() {
        $this->setMethod('post');
        
        #name
        $name = new Zend_Form_Element_Text('name');
        $name->setLabel('Name:')
                ->setRequired(true)
                ->setOptions(array('class'=>'span12'))
                ->addFilter('StringTrim')
                ->addFilter('HtmlEntities');
        
        #email
        $email = new Zend_Form_Element_Text('email');
        $email->setLabel('Email:')
                ->setRequired(true)
                ->setOptions(array('class'=>'span12'))
                ->addFilter('StringTrim')
                ->addFilter('StringToLower')
                ->addValidator('EmailAddress')
                ->addErrorMessage("Enter Valid Email Address");
        #contact no
        $contact = new Zend_Form_Element_Text('contact');
        $contact->setLabel('Contact Number:')
                ->setRequired(true)
                ->setOptions(array('class'=>'span12'))
                ->addFilter('StringTrim')
                ->addValidator('regex', false, array('/^[0-9 ]+$/'))
                ->addErrorMessages(array("Invalid telephone number"));
        #title
        $title = new Zend_Form_Element_Text('title');
        $title->setLabel('Title:')
                ->addFilter('StringTrim')
                ->setOptions(array('class'=>'span12'))
                ->addFilter('HtmlEntities')
                ->setRequired(true);
        
        #message
        $message = new Zend_Form_Element_Textarea('message');
        $message->setLabel('Message:')
                ->setRequired(true)
                ->setOptions(array('class'=>'span12'))
                ->addFilter('StringTrim')
                ->addFilter('HtmlEntities')
                ->setOptions(array('cols'=>'40','rows'=>'4'));
        
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Send Message')
                ->setAttribs(array('class'=>'btn btn-success'));
        
        
        $this->addElements(array($name,$email,$contact,$title,$message,$submit));
        
        
    }

}

